#ifndef BRBUTTON_H_
#define BRBUTTON_H_
#include "SDL/SDL.h"

#include "Sprite.h"

typedef enum _BrButtonStatus {
    BR_BUTTON_STATUS_OUT = 1,
    BR_BUTTON_STATUS_IN = 2,
    BR_BUTTON_STATUS_PRESSED = 3,
} BrButtonStatus;

class CBrButton  : public Sprite{
public:
    /**按钮的显示区域**/
    SDL_Rect m_rcButton;
    /**按钮是否显示**/
    bool m_bShow;
    /**按钮是否监听事件**/
    bool m_bListen;
    /**按钮标识**/
    int m_iId;

    CBrButton();
    ~CBrButton();
    void CreateTexture(SDL_Surface* effectIn, SDL_Surface* effectOut,
                       SDL_Surface* effectPressed);
    //处理事件
    bool handleEvent(SDL_Event & stEvent);
    /**回调函数**/
    void setFuncPressed(void (*func_pressed)(const CBrButton *));

    void SetRect(const SDL_Rect &rc);
    SDL_Rect GetRect();

	void render();

private:
    /**鼠标在按钮内的显示**/
    SDL_Texture* m_pTextureIn;
    /**鼠标在按钮外的显示**/
    SDL_Texture* m_pTextureOut;
    /**鼠标在按钮按下的显示**/
    SDL_Texture* m_pTexturePressed;
    /**鼠标当前状态**/
    BrButtonStatus m_status;

    bool bPointIn(int x, int y);
    void (*m_func_pressed)(const CBrButton * pButton);
    SDL_Texture * GetShowTexture();
};

#endif /* BRBUTTON_H_ */